package com.gmq.javaMulti.chapter02;

/**
 * Created by gmq on 2018/10/07.
 * 2.8 程序的幽灵：隐蔽的错误
 * @version 1.0
 * @since 2018/10/07 15:10
 */
public class HiddenBug {

    public static void main(String[] args) {
        // 2147483647
        //System.out.println(Integer.MAX_VALUE);
        // -2147483648
        //System.out.println(Integer.MIN_VALUE);
        // 9223372036854775807
        System.out.println(Long.MAX_VALUE);
        // -9223372036854775808
        System.out.println(Long.MIN_VALUE);

        int v1 = 1073741827;
        int v2 = 1431655768;
        int sum = v1 + v2;
        // 溢出
        System.out.println(sum);
        System.out.println(sum > Integer.MAX_VALUE);
        int ave = (v1 + v2) / 2;
        System.out.println(ave);
    }
}
